/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package schedulerManagerment.Vacancy;

import connection.Configuration;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Tngoc
 */
public class Vacancy {
    private int id;
    private String Company;
    private String field;
    private int amount;
    private Date dateOfPost;
    private String gender;
    private int status;
    private String interviewer;
    private ArrayList<Skill> skills;

    public Vacancy() {
    }

    public String getCompany() {
        return Company;
    }

    public void setCompany(String Company) {
        this.Company = Company;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public Date getDateOfPost() {
        return dateOfPost;
    }

    public void setDateOfPost(Date dateOfPost) {
        this.dateOfPost = dateOfPost;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
        Connection conn = new Configuration().getConnect();
        skills = new ArrayList<>();
        try {
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery("select Skill.* from Skill,VacancySkill_Detail where VacancySkill_Detail.skillID=Skill.ID and VacancySkill_Detail.VacancyID ="+id);
            while(rs.next()){
                Skill s = new Skill(rs.getInt("ID"),rs.getString("name"));
                skills.add(s);
            }
        } catch (SQLException ex) {
            Logger.getLogger(Vacancy.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }

    public String getInterviewer() {
        return interviewer;
    }

    public void setInterviewer(String interviewer) {
        this.interviewer = interviewer;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public ArrayList<Skill> getSkills() {
        return skills;
    }

    
}
